#include<cstdio>

int sg[10000];

void init()
{
	sg[0] = 0; sg[1] = 1;
	for (int i = 2; i <= 1000; i++) {
		bool vis[1010] = {false};
		for (int j = 0; j <= i; j++) {
			vis[sg[j]] = true;
			if (j != 0 && j != i) {
                for (int k = 1; k < i - j; k++)
					vis[sg[j] ^ sg[k] ^ sg[i - j - k]] = true;
			}
		}
		int j = 0;
		while (vis[j] != 0) j++;
		sg[i] = j;
	}
}

int main()
{
	init();
	for (int i = 1; i <= 1000; i++) {
		printf("%d\t", sg[i]);
		if (i % 8 == 0) printf("\n");
	}
}

